package com.zzh.lib.views.drawer;


import android.graphics.Canvas;

import com.zzh.lib.views.banner.IndicatorOptions;

/**
 * Created by ZZH on 2023/2/16.
 *
 * @date: 2023/2/16 09:35
 * @email: zzh_hz@126.com
 * @author: zzh
 * @description: com.zzh.lib.views.drawer
 */
public class DrawerProxy implements IDrawer {
    private IndicatorOptions indicatorOptions;
    private IDrawer mIDrawer;

    public DrawerProxy(IndicatorOptions indicatorOptions) {
        this.indicatorOptions = indicatorOptions;
        init(indicatorOptions);
    }

    private void init(IndicatorOptions indicatorOptions) {
        mIDrawer = DrawerFactory.createDrawer(indicatorOptions);
    }

    @Override
    public void onLayout(boolean changed, int left, int top, int right, int bottom) {

    }

    @Override
    public BaseDrawer.MeasureResult onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        return mIDrawer.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

    @Override
    public void onDraw(Canvas canvas) {
        mIDrawer.onDraw(canvas);
    }

    public DrawerProxy setIndicatorOptions(IndicatorOptions indicatorOptions) {
        this.indicatorOptions = indicatorOptions;
        init(indicatorOptions);
        return this;
    }
}
